package com.zhkj.txg.module.mine.model

import com.zhkj.lib.http.BaseApiService
import com.zhkj.lib.http.BaseResponse
import com.zhkj.txg.module.home.entity.HotGoodsResponse
import com.zhkj.txg.module.home.entity.RechargeListResponse
import com.zhkj.txg.module.mine.entity.*
import com.zhkj.txg.module.mine.vm.EditUserInfoResponse
import com.zhkj.txg.module.order.entity.OrderPayResponse
import io.reactivex.Observable
import retrofit2.http.*

interface MineApi : BaseApiService {

    @GET("api/index/hotGoods")
    fun hotGoods(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") numb: Int
    ): Observable<HotGoodsResponse>

    @GET("api/user/index")
    fun userCenter(@Query("token") token: String): Observable<UserCenterResponse>

    @FormUrlEncoded
    @POST("api/user/profile")
    fun userInfoChange(
        @Field("token") token: String,
        @Field("nickname") nickname: String,
        @Field("birthday") birthday: String,
        @Field("gender") gender: String,
        @Field("province") province: Int,
        @Field("city") city: Int,
        @Field("district") district: Int,
        @Field("avatar") avatar: String
    ): Observable<EditUserInfoResponse>

    @GET("api/user/moneylog")
    fun balanceList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") numb: Int
    ): Observable<BalanceListResponse>

    @FormUrlEncoded
    @POST("api/user/recharge")
    fun recharge(
        @Field("token") token: String,
        @Field("money") money: String,
        @Field("payType") payType: String,// 充值类型 wechat=>微信 alipay=>支付宝
        @Field("shop_id") shopId: String
    ): Observable<OrderPayResponse>

    @GET("api/user/withdrawConfig")
    fun getWithdrawConfig(@Query("token") token: String): Observable<WithdrawConfigResponse>

    @FormUrlEncoded
    @POST("api/user/withdraw")
    fun withdraw(
        @Field("token") token: String,
        @Field("money") money: String,
        @Field("type") type: String,
        @Field("__token__") withdrawToken: String
    ): Observable<BaseResponse>

    @GET("api/user/logout")
    fun logout(@Query("token") token: String): Observable<BaseResponse>

    @GET("api/user/collectList")
    fun collectionList(
        @Query("token") token: String,
        @Query("shop_id") shopId:String,

        @Query("page") page: Int,
        @Query("rows") rows: Int,
        @Query("type") type: String
    ): Observable<CollectionListResponse>

    @FormUrlEncoded
    @POST("api/user/cancelCollect")
    fun cancelCollection(
        @Field("token") token: String,
        @Field("collect_id") collectionIds: String,
        @Field("type") type: String
    ): Observable<BaseResponse>

    @GET("api/coupon/userCouponList")
    fun couponList(
        @Query("token") token: String,
        @Query("useType") useType: Int,// 使用类型 0全部 1全场 2商品 3店铺
        @Query("apiType") apiType: Int,// 接口类型 默认0 查看历史优惠券时必传1
        @Query("status") status: Int,// 状态 默认0 0未使用 1已使用 2已过期
        @Query("page") page: Int,
        @Query("rows") rows: Int
    ): Observable<CouponListResponse>

    @GET("api/coupon/couponCenterList")
    fun couponCenter(
        @Query("token") token: String,
        @Query("useType") useType: Int, // 使用类型 0全部 1全场 2商品 3店铺
        @Query("page") page: Int,
        @Query("rows") rows: Int
    ): Observable<CouponCenterResponse>

    @FormUrlEncoded
    @POST("api/coupon/getCoupon")
    fun getCoupon(
        @Field("token") token: String,
        @Field("id") id: Long
    ): Observable<CouponGetResponse>

    @GET("api/user/visitLog")
    fun visitLog(
        @Query("token") token: String,
        @Query("page") page: Int, @Query("rows") numb: Int
    ): Observable<VisitLogResponse>

    @GET("api/find/userFind")
    fun publishList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") numb: Int
    ): Observable<PublishListResponse>

    @FormUrlEncoded
    @POST("api/find/delete")
    fun deleteArticle(
        @Field("token") token: String,
        @Field("id") id: Long
    ): Observable<DeleteArticleResponse>

    @FormUrlEncoded
    @POST("api/user/bindWechat")
    fun bindWeChat(@Field("token") token: String, @Field("code") code: String): Observable<BaseResponse>

    @GET("api/user/security")
    fun getUserBindData(@Query("token") token: String): Observable<UserBindResponse>

    @FormUrlEncoded
    @POST("api/user/bindAlipay")
    fun bindAliPay(
        @Field("token") token: String,
        @Field("name") name: String,
        @Field("account") account: String
    ): Observable<BaseResponse>

    @GET("api/article/aboutUs")
    fun aboutUs(): Observable<AboutUsResponse>

    @GET("api/article/guideList")
    fun guideList(): Observable<GuideListResponse>

    @FormUrlEncoded
    @POST("api/user/delVisit")
    fun deleteVisitLog(@Field("token") token: String, @Field("ids") ids: String): Observable<BaseResponse>

    @GET("api/notify/systemNotify")
    fun notification(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") rows: Int
    ): Observable<NotificationResponse>

    @GET("api/order/refundList")
    fun refundList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") rows: Int
    ): Observable<RefundListResponse>

    @GET("api/member/withdrawConfig")
    fun withdrawConfig(@Query("token") token: String): Observable<WithdrawConfigResponse>

    @FormUrlEncoded
    @POST("api/member/withdraw")
    fun memberWithdraw(
        @Field("token") token: String,
        @Field("money") money: String,
        @Field("type") type: String,
        @Field("__token__") withdrawToken: String
    ): Observable<BaseResponse>

    @GET("api/member/withdrawlog")
    fun memberWithdrawList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") rows: Int,
        @Query("date") date: String
    ): Observable<WithdrawListResponse>

    @GET("api/user/withdrawlog")
    fun withdrawList(
        @Query("token") token: String,
        @Query("page") page: Int,
        @Query("rows") rows: Int,
        @Query("date") date: String
    ): Observable<WithdrawListResponse>

    @GET("api/user/referrer")
    fun getReferrer(@Query("token") token: String): Observable<ReferrerResponse>


    @GET("api/user_card/userCardList")
    fun getUserCardList(@Query("token") token: String): Observable<DiamondResponse>

    @GET("api/user/recharge_list")
    fun getRechargeList(@Query("token") token: String): Observable<RechargeListResponse>

    @GET("api/article/recharge")
    fun getRecharge(@Query("token") token: String): Observable<BaseResponse>

    @POST("api/user_card/submitOrder")
    fun getSubmitOrder(
        @Query("token") token: String,
        @Query("card_id") cardId: String,
        @Query("valid_date") validDate: String,
        @Query("shop_id") shopId: String
    ): Observable<SubmitOrderResponse>

    @POST("api/user_card/payOrder")
    fun getPayOrder(
        @Query("token") token: String,
        @Query("order_sn") orderSn: String,
        @Query("pay_type") payType: String
    ): Observable<PayOrderResponse>

    @POST("api/user/feedback")
    fun setFeedback(
        @Query("token") token: String,
        @Query("content") content: String,
        @Query("images") images: String?
    ): Observable<BaseResponse>


    @POST("api/article/commonProblem")
    fun getCommonProblem(
        @Query("token") token: String
    ): Observable<ProblemResponse>


    @POST("api/article/detail")
    fun getProblemDetail(
        @Query("token") token: String, @Query("id") id: String
    ): Observable<ProblemDetailResponse>

    @POST("api/common/getVersion")
    fun getVersion(
        @Query("token") token: String
    ): Observable<VersionResponse>
}